3.5.29 \(\int \cot (c+d x) (a+b \tan (c+d x))^2 \, dx\) [429]

Optimal. Leaf size=35 \[ 2 a b x-\frac {b^2 \log (\cos (c+d x))}{d}+\frac {a^2 \log (\sin (c+d x))}{d} \]

[Out]

2*a*b*x-b^2*ln(cos(d*x+c))/d+a^2*ln(sin(d*x+c))/d

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, integrand size = 19, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.105, Rules used = {3622, 3556} \begin {gather*} \frac {a^2 \log (\sin (c+d x))}{d}+2 a b x-\frac {b^2 \log (\cos (c+d x))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

2*a*b*x - (b^2*Log[Cos[c + d*x]])/d + (a^2*Log[Sin[c + d*x]])/d

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3622

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^2/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[d*(2*
b*c - a*d)*(x/b^2), x] + (Dist[d^2/b, Int[Tan[e + f*x], x], x] + Dist[(b*c - a*d)^2/b^2, Int[1/(a + b*Tan[e +
f*x]), x], x]) /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0]

Rubi steps

\begin {align*} \int \cot (c+d x) (a+b \tan (c+d x))^2 \, dx &=2 a b x+a^2 \int \cot (c+d x) \, dx+b^2 \int \tan (c+d x) \, dx\\ &=2 a b x-\frac {b^2 \log (\cos (c+d x))}{d}+\frac {a^2 \log (\sin (c+d x))}{d}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.06, size = 43, normalized size = 1.23 \begin {gather*} 2 a b x-\frac {b^2 \log (\cos (c+d x))}{d}+\frac {a^2 (\log (\cos (c+d x))+\log (\tan (c+d x)))}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]*(a + b*Tan[c + d*x])^2,x]

[Out]

2*a*b*x - (b^2*Log[Cos[c + d*x]])/d + (a^2*(Log[Cos[c + d*x]] + Log[Tan[c + d*x]]))/d

________________________________________________________________________________________

Maple [A]
time = 0.18, size = 38, normalized size = 1.09

method result size
derivativedivides \(\frac {a^{2} \ln \left (\sin \left (d x +c \right )\right )+2 a b \left (d x +c \right )-b^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}\) \(38\)
default \(\frac {a^{2} \ln \left (\sin \left (d x +c \right )\right )+2 a b \left (d x +c \right )-b^{2} \ln \left (\cos \left (d x +c \right )\right )}{d}\) \(38\)
norman \(2 a b x +\frac {a^{2} \ln \left (\tan \left (d x +c \right )\right )}{d}-\frac {\left (a^{2}-b^{2}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d}\) \(46\)
risch \(2 a b x -i a^{2} x +i b^{2} x -\frac {2 i a^{2} c}{d}+\frac {2 i b^{2} c}{d}+\frac {a^{2} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}{d}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) b^{2}}{d}\) \(80\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)*(a+b*tan(d*x+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/d*(a^2*ln(sin(d*x+c))+2*a*b*(d*x+c)-b^2*ln(cos(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.51, size = 49, normalized size = 1.40 \begin {gather*} \frac {4 \, {\left (d x + c\right )} a b + 2 \, a^{2} \log \left (\tan \left (d x + c\right )\right ) - {\left (a^{2} - b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

1/2*(4*(d*x + c)*a*b + 2*a^2*log(tan(d*x + c)) - (a^2 - b^2)*log(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Fricas [A]
time = 0.93, size = 56, normalized size = 1.60 \begin {gather*} \frac {4 \, a b d x + a^{2} \log \left (\frac {\tan \left (d x + c\right )^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - b^{2} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/2*(4*a*b*d*x + a^2*log(tan(d*x + c)^2/(tan(d*x + c)^2 + 1)) - b^2*log(1/(tan(d*x + c)^2 + 1)))/d

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 70 vs. \(2 (32) = 64\).
time = 0.21, size = 70, normalized size = 2.00 \begin {gather*} \begin {cases} - \frac {a^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} + \frac {a^{2} \log {\left (\tan {\left (c + d x \right )} \right )}}{d} + 2 a b x + \frac {b^{2} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 d} & \text {for}\: d \neq 0 \\x \left (a + b \tan {\left (c \right )}\right )^{2} \cot {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))**2,x)

[Out]

Piecewise((-a**2*log(tan(c + d*x)**2 + 1)/(2*d) + a**2*log(tan(c + d*x))/d + 2*a*b*x + b**2*log(tan(c + d*x)**
2 + 1)/(2*d), Ne(d, 0)), (x*(a + b*tan(c))**2*cot(c), True))

________________________________________________________________________________________

Giac [A]
time = 0.67, size = 50, normalized size = 1.43 \begin {gather*} \frac {4 \, {\left (d x + c\right )} a b + 2 \, a^{2} \log \left ({\left | \tan \left (d x + c\right ) \right |}\right ) - {\left (a^{2} - b^{2}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{2 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)*(a+b*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/2*(4*(d*x + c)*a*b + 2*a^2*log(abs(tan(d*x + c))) - (a^2 - b^2)*log(tan(d*x + c)^2 + 1))/d

________________________________________________________________________________________

Mupad [B]
time = 4.19, size = 61, normalized size = 1.74 \begin {gather*} \frac {a^2\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )}{d}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,{\left (b+a\,1{}\mathrm {i}\right )}^2}{2\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,{\left (a+b\,1{}\mathrm {i}\right )}^2}{2\,d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(c + d*x)*(a + b*tan(c + d*x))^2,x)

[Out]

(log(tan(c + d*x) + 1i)*(a*1i + b)^2)/(2*d) - (log(tan(c + d*x) - 1i)*(a + b*1i)^2)/(2*d) + (a^2*log(tan(c + d
*x)))/d

________________________________________________________________________________________